<?php
class JLoja_Html_Table
{
	protected $_obj;

	protected $_header;

	protected $_columns;

	private $_params;
	
	public function __construct( $params )
	{
		$this->_params = $params;
	}

	public function setHeader( JLoja_Html_Table_Header $head )
	{
		$this->_header = $head->getHeader();
	}

	public function addRow( JLoja_Html_Table_Row $row )
	{
		$this->_columns[] = $row->getRows();
	}

	public function setFooter( JLoja_Html_Table_Footer $foot )
	{
		$this->_header = $head->getFooter();
	}

	public function render()
	{
		$params = "";
		foreach( $this->_params as $key => $val ){
			$params .= $key . '="' . $val . '"';
		}
		$html = "<table $params>";
		$html .= "<thead>";
		$html .= "<tr>".$this->_header . "</tr>";
		$html .= "</thead>";
		$html .= "<tbody>";
		foreach( $this->_columns as $c ){
			$html .= "<tr>";
			$html .= $c;
			$html .= "</tr>";
		}
		$html .= "</tbody>";
		$html .= "</table>";

		echo $html;
	}
}